1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.ViewSwitcher; 26 27 private import adw.ViewStack; 28 private import adw.c.functions; 29 public import adw.c.types; 30 private import glib.ConstructionException; 31 private import gobject.ObjectG; 32 private import gtk.AccessibleIF; 33 private import gtk.AccessibleT; 34 private import gtk.BuildableIF; 35 private import gtk.BuildableT; 36 private import gtk.ConstraintTargetIF; 37 private import gtk.ConstraintTargetT; 38 private import gtk.Widget; 39 40 41 /** 42 * An adaptive view switcher. 43 * 44 * <picture> 45 * <source srcset="view-switcher-dark.png" media="(prefers-color-scheme: dark)"> 46 * <img src="view-switcher.png" alt="view-switcher"> 47 * </picture> 48 * 49 * An adaptive view switcher designed to switch between multiple views 50 * contained in a [class@ViewStack] in a similar fashion to 51 * [class@Gtk.StackSwitcher]. 52 * 53 * `AdwViewSwitcher` buttons always have an icon and a label. They can be 54 * displayed side by side, or icon on top of the label. This can be controlled 55 * via the [property@ViewSwitcher:policy] property. 56 * 57 * Most applications should be using [class@ViewSwitcherBar] and 58 * [class@ViewSwitcherTitle]. 59 * 60 * ## CSS nodes 61 * 62 * `AdwViewSwitcher` has a single CSS node with name `viewswitcher`. It can have 63 * the style classes `.wide` and `.narrow`, matching its policy. 64 * 65 * ## Accessibility 66 * 67 * `AdwViewSwitcher` uses the `GTK_ACCESSIBLE_ROLE_TAB_LIST` role and uses the 68 * `GTK_ACCESSIBLE_ROLE_TAB` for its buttons. 69 * 70 * Since: 1.0 71 */ 72 public class ViewSwitcher : Widget 73 { 74 /** the main Gtk struct */ 75 protected AdwViewSwitcher* adwViewSwitcher; 76 77 /** Get the main Gtk struct */ 78 public AdwViewSwitcher* getViewSwitcherStruct(bool transferOwnership = false) 79 { 80 if (transferOwnership) 81 ownedRef = false; 82 return adwViewSwitcher; 83 } 84 85 /** the main Gtk struct as a void* */ 86 protected override void* getStruct() 87 { 88 return cast(void*)adwViewSwitcher; 89 } 90 91 /** 92 * Sets our main struct and passes it to the parent class. 93 */ 94 public this (AdwViewSwitcher* adwViewSwitcher, bool ownedRef = false) 95 { 96 this.adwViewSwitcher = adwViewSwitcher; 97 super(cast(GtkWidget*)adwViewSwitcher, ownedRef); 98 } 99 100 101 /** */ 102 public static GType getType() 103 { 104 return adw_view_switcher_get_type(); 105 } 106 107 /** 108 * Creates a new `AdwViewSwitcher`. 109 * 110 * Returns: the newly created `AdwViewSwitcher` 111 * 112 * Since: 1.0 113 * 114 * Throws: ConstructionException GTK+ fails to create the object. 115 */ 116 public this() 117 { 118 auto __p = adw_view_switcher_new(); 119 120 if(__p is null) 121 { 122 throw new ConstructionException("null returned by new"); 123 } 124 125 this(cast(AdwViewSwitcher*) __p); 126 } 127 128 /** 129 * Gets the policy of @self. 130 * 131 * Returns: the policy of @self 132 * 133 * Since: 1.0 134 */ 135 public AdwViewSwitcherPolicy getPolicy() 136 { 137 return adw_view_switcher_get_policy(adwViewSwitcher); 138 } 139 140 /** 141 * Gets the stack controlled by @self. 142 * 143 * Returns: the stack 144 * 145 * Since: 1.0 146 */ 147 public ViewStack getStack() 148 { 149 auto __p = adw_view_switcher_get_stack(adwViewSwitcher); 150 151 if(__p is null) 152 { 153 return null; 154 } 155 156 return ObjectG.getDObject!(ViewStack)(cast(AdwViewStack*) __p); 157 } 158 159 /** 160 * Sets the policy of @self. 161 * 162 * Params: 163 * policy = the new policy 164 * 165 * Since: 1.0 166 */ 167 public void setPolicy(AdwViewSwitcherPolicy policy) 168 { 169 adw_view_switcher_set_policy(adwViewSwitcher, policy); 170 } 171 172 /** 173 * Sets the stack controlled by @self. 174 * 175 * Params: 176 * stack = a stack 177 * 178 * Since: 1.0 179 */ 180 public void setStack(ViewStack stack) 181 { 182 adw_view_switcher_set_stack(adwViewSwitcher, (stack is null) ? null : stack.getViewStackStruct()); 183 } 184 }